%icremed
% 2/11/97
% creates mean and median real scores for each year
% does the same for nominal scores too
% Modified by Dave Primo 7/2000

yreal = (y-aNs)./bNs;

%%%%%%%%%%%%%%  create House means and medians for each year  %%%%%%%%

hmed = [];
hmean = [];
hnommed = [];
hnommean = [];
for ttt = BeginYear:HEndYear,
  tind = find(t==ttt);
  curmean = sum( yreal(tind) ) / length(tind);
  hmean = [hmean;curmean];
  curmean = sum( y(tind) ) / length(tind);
  hnommean = [hnommean;curmean];

  yreatem = sort(yreal(tind));
  %lab1 = round(length(tind)/2);
  %lab2 = fix(length(tind)/2);
  lab1 = round( (length(tind)/2 + 1) );
  lab2 = fix( (length(tind)/2 + 1) );
  curmed = ( yreatem(lab1) + yreatem(lab2) )/2;
  hmed = [hmed;curmed];

  ytem = sort(y(tind));
  lab1 = round( (length(tind)/2 + 1) );
  lab2 = fix( (length(tind)/2 + 1) );
  curmed = ( ytem(lab1) + ytem(lab2) )/2;
  hnommed = [hnommed;curmed];
end;


disp(' year  hou_nom_mean hou_rea_mean  hou_nom_med hou_rea_med');
ymed1 = [ayear, hnommean, hmean, hnommed, hmed]

save medhouseacu7199.txt ymed1 /ascii;
